<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Login</title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="./images/favicon.ico"/>
<!--    <link rel="shortcut icon" type="image/x-icon" href="./images/favicon.png"/>-->
<!--    <link href="https://fonts.googleapis.com/css?family=Montserrat:300,300i,400,400i,500,500i,600,600i,700,700i&display=swap"-->
<!--          rel="stylesheet">-->
<!--    <link href="https://fonts.googleapis.com/css?family=Lato:300,300i,400,400i,700,700i&display=swap" rel="stylesheet">-->
    <link rel="stylesheet" href="./css/bootstrap.min.css">
    <link rel="stylesheet" href="./css/font-awesome.min.css">
    <link rel="stylesheet" href="./css/owl.carousel.min.css">
    <link rel="stylesheet" href="./css/animate.min.css">
    <link rel="stylesheet" href="./css/jquery-ui.css">
    <link rel="stylesheet" href="./css/slick.css">
    <link rel="stylesheet" href="./css/chosen.min.css">
    <link rel="stylesheet" href="./css/pe-icon-7-stroke.css">
    <link rel="stylesheet" href="./css/magnific-popup.min.css">
    <link rel="stylesheet" href="./css/lightbox.min.css">
    <link rel="stylesheet" href="./js/fancybox/source/jquery.fancybox.css">
    <link rel="stylesheet" href="./css/jquery.scrollbar.min.css">
    <link rel="stylesheet" href="./css/mobile-menu.css">
    <link rel="stylesheet" href="./fonts/flaticon/flaticon.css">
    <link rel="stylesheet" href="./css/style.css">
</head>
<body class="inblog-page">
<div class="main-content main-content-login">
    <div class="container">
        <div class="row">
            <div class="content-area col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <div class="site-main">
                    <h3 class="custom_blog_title">
                        气清商城登录
                    </h3>
                    <div class="customer_login">
                        <div class="row">
                            <div class="col-lg-6 col-md-6 col-sm-12">
                                <div class="login-item">
                                    <h5 class="title-login">登录你的账户</h5>
                                    <form class="login">
                                        <p class="form-row form-row-wide">
                                            <label class="text">用户名</label>
                                            <input id="name" title="name" type="text" class="input-text">
                                        </p>
                                        <p class="form-row form-row-wide">
                                            <label class="text">密码</label>
                                            <input  id="password" title="password" type="password" class="input-text">
                                        </p>
                                        <p class="lost_password">
<!--												<span class="inline">-->
<!--													<input type="checkbox" id="cb1">-->
<!--													<label for="cb1" class="label-text">记住我</label>-->
<!--												</span>-->
                                            <a href="http://www.qk.com/regist" class="forgot-pw">现在注册</a>
                                        </p>

                                        <p class="form-row">
                                            <input type="submit" class="button-submit" value="登录">
                                        </p>

                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<a href="#" class="backtotop">
    <i class="fa fa-angle-double-up"></i>
</a>
<script type="text/javascript" src="./js/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="./js/jquery.plugin-countdown.min.js"></script>
<script type="text/javascript" src="./js/jquery-countdown.min.js"></script>
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
<script type="text/javascript" src="./js/owl.carousel.min.js"></script>
<script type="text/javascript" src="./js/magnific-popup.min.js"></script>
<script type="text/javascript" src="./js/isotope.min.js"></script>
<script type="text/javascript" src="./js/jquery.scrollbar.min.js"></script>
<script type="text/javascript" src="./js/jquery-ui.min.js"></script>
<script type="text/javascript" src="./js/mobile-menu.js"></script>
<script type="text/javascript" src="./js/chosen.min.js"></script>
<script type="text/javascript" src="./js/slick.js"></script>
<script type="text/javascript" src="./js/jquery.elevateZoom.min.js"></script>
<script type="text/javascript" src="./js/jquery.actual.min.js"></script>
<script type="text/javascript" src="./js/fancybox/source/jquery.fancybox.js"></script>
<script type="text/javascript" src="./js/lightbox.min.js"></script>
<script type="text/javascript" src="./js/owl.thumbs.min.js"></script>
<script type="text/javascript" src="./js/jquery.scrollbar.min.js"></script>
<script type="text/javascript" src="./js/frontend-plugin.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $(".form-row")
            .on("click", ".button-submit", doLogin)
    });

    function doLogin() {

        var name = $('#name').val();
        var password = $('#password').val();
        // var remenberme = $("input[type='checkbox']").is(':checked');
        // console.log(remenberme);

        var user = {
            "username":name,
            "password":password,
            //判断是否要生成一个cookie
            // "remenberme":remenberme
        }

        $.ajax({
            url: '/user/doLogin',
            dataType: "json",
            type: "post",
            data: user,
            xhrFields: {withCredentials: true},
            success: function (result) {
                console.log(result)
                if (result.status == 200){
                    window.alert("登录成功！")
                    // window.location = "http://www.qk.com/"
                    location.href = 'index?it=' + Math.random();
                    // location.href = '/index?t=' + Math.random();

                }else {
                    window.alert("用户名或密码错误！")
                }
            }

        })
        return false;
    }

</script>
</body>
</html>